<?php
/**
 * Created by YuanXiBlog.
 * User: YuanXi
 * Date: 2021/6/12 0012
 * Time: 1:45
 */

namespace App\Transformers;


use App\Models\User;
use League\Fractal\TransformerAbstract;

class UserTransformer extends TransformerAbstract
{
    public function transform(User $user)
    {
        return [
            'id' => $user->id,
            'name' => $user->name,
            'email' => $user->email,
            'is_locked' => $user->is_locked,
            'phone' => $user->phone,
            'avatar' => $user->avatar,
            'avatar_url' => oss_url($user->avatar),
            'created_at' => $user->created_at,
            'updated_at' => $user->updated_at,
        ];
    }
}
